# -*- coding: UTF-8 -*-

from api.controller.pole_guy_controller import PoleGuyController
from api.middleware.app import AppMiddleWare
from app import app

app.wsgi_app = AppMiddleWare(app.wsgi_app)

"""服务商路由"""

# 获取设备的最新上报数据
app.add_url_rule(
    "/v1/zhongtie/poleguy/query",
    view_func=PoleGuyController.as_view('zhongtie.poleguy.query.model'),
    methods=['GET'],
)

# 下属设置的最新配置
#正面指定一个路径参数为id
app.add_url_rule(
    "/v1/zhongtie/poleguy/<string:id>/config",
    view_func=PoleGuyController.as_view('zhongtie.poleguy.config.model'),
    methods=['PUT'],
)

if __name__ == '__main__':
    # app.run(host="172.17.181.16", port=8887)
    app.run(host="0.0.0.0", port=8887)
    # app.run(host="127.0.0.1", port=8887)
